home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2000 September / maximum-cd-2000-09.iso / Vampire the Masquerade / vampire_demo.exe / Codex.nob / ClassBreakable.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-06-22  |  3.3 KB  |  88 lines

  1. public class ClassBreakable extends Codex {
  2.    private CodexThing _gib1;
  3.    private CodexThing _gib2;
  4.    private CodexThing _gib3;
  5.    private CodexThing _gib4;
  6.    private CodexThing _gib5;
  7.    private float[] velocity = new float[3];
  8.    private float[] rotVelocity = new float[3];
  9.    private boolean _bTriggered;
  10.    public static String[] _params = new String[]{"Gib 1", "Gib 2", "Gib 3", "Gib 4", "Gib 5", "Velocity X", "Velocity Y", "Velocity Z", "Rotational Velocity X", "Rotational Velocity Y", "Rotational Velocity Z"};
  11.  
  12.    public void beginscene(int clientGuid, int captureID) {
  13.       if (!this._bTriggered) {
  14.          float[] tempVel = new float[3];
  15.          float[] tempRotVel = new float[3];
  16.          tempVel[0] = this.velocity[0] * (float)Math.random() * (float)(Math.random() < (double)0.5F ? -1 : 1);
  17.          tempVel[1] = this.velocity[1] * (float)Math.random() * (float)(Math.random() < (double)0.5F ? -1 : 1);
  18.          tempVel[2] = this.velocity[2] * (float)Math.random() * (float)(Math.random() < (double)0.5F ? -1 : 1);
  19.          this._gib1.SetVelocity(tempVel);
  20.          tempRotVel[0] = this.rotVelocity[0] * (float)Math.random() * (float)(Math.random() < (double)0.5F ? -1 : 1);
  21.          tempRotVel[1] = this.rotVelocity[1] * (float)Math.random() * (float)(Math.random() < (double)0.5F ? -1 : 1);
  22.          tempRotVel[2] = this.rotVelocity[2] * (float)Math.random() * (float)(Math.random() < (double)0.5F ? -1 : 1);
  23.          this._gib1.SetRotVelocity(tempRotVel);
  24.          this._gib1.SetPhysicsFlags(8);
  25.          tempVel[0] = this.velocity[0] * (float)Math.random() * (float)(Math.random() < (double)0.5F ? -1 : 1);
  26.          tempVel[1] = this.velocity[1] * (float)Math.random() * (float)(Math.random() < (double)0.5F ? -1 : 1);
  27.          tempVel[2] = this.velocity[2] * (float)Math.random() * (float)(Math.random() < (double)0.5F ? -1 : 1);
  28.          this._gib2.SetVelocity(tempVel);
  29.          tempRotVel[0] = this.rotVelocity[0] * (float)Math.random() * (float)(Math.random() < (double)0.5F ? -1 : 1);
  30.          tempRotVel[1] = this.rotVelocity[1] * (float)Math.random() * (float)(Math.random() < (double)0.5F ? -1 : 1);
  31.          tempRotVel[2] = this.rotVelocity[2] * (float)Math.random() * (float)(Math.random() < (double)0.5F ? -1 : 1);
  32.          this._gib2.SetRotVelocity(tempRotVel);
  33.          this._gib2.SetPhysicsFlags(8);
  34.          tempVel[0] = this.velocity[0] * (float)Math.random() * (float)(Math.random() < (double)0.5F ? -1 : 1);
  35.          tempVel[1] = this.velocity[1] * (float)Math.random() * (float)(Math.random() < (double)0.5F ? -1 : 1);
  36.          tempVel[2] = this.velocity[2] * (float)Math.random() * (float)(Math.random() < (double)0.5F ? -1 : 1);
  37.          this._gib3.SetVelocity(tempVel);
  38.          tempRotVel[0] = this.rotVelocity[0] * (float)Math.random() * (float)(Math.random() < (double)0.5F ? -1 : 1);
  39.          tempRotVel[1] = this.rotVelocity[1] * (float)Math.random() * (float)(Math.random() < (double)0.5F ? -1 : 1);
  40.          tempRotVel[2] = this.rotVelocity[2] * (float)Math.random() * (float)(Math.random() < (double)0.5F ? -1 : 1);
  41.          this._gib3.SetRotVelocity(tempRotVel);
  42.          this._gib3.SetPhysicsFlags(8);
  43.          tempVel[0] = this.velocity[0] * (float)Math.random() * (float)(Math.random() < (double)0.5F ? -1 : 1);
  44.          tempVel[1] = this.velocity[1] * (float)Math.random() * (float)(Math.random() < (double)0.5F ? -1 : 1);
  45.          tempVel[2] = this.velocity[2] * (float)Math.random() * (float)(Math.random() < (double)0.5F ? -1 : 1);
  46.          this._gib4.SetVelocity(tempVel);
  47.          tempRotVel[0] = this.rotVelocity[0] * (float)Math.random() * (float)(Math.random() < (double)0.5F ? -1 : 1);
  48.          tempRotVel[1] = this.rotVelocity[1] * (float)Math.random() * (float)(Math.random() < (double)0.5F ? -1 : 1);
  49.          tempRotVel[2] = this.rotVelocity[2] * (float)Math.random() * (float)(Math.random() < (double)0.5F ? -1 : 1);
  50.          this._gib4.SetRotVelocity(tempRotVel);
  51.          this._gib4.SetPhysicsFlags(8);
  52.          tempVel[0] = this.velocity[0] * (float)Math.random() * (float)(Math.random() < (double)0.5F ? -1 : 1);
  53.          tempVel[1] = this.velocity[1] * (float)Math.random() * (float)(Math.random() < (double)0.5F ? -1 : 1);
  54.          tempVel[2] = this.velocity[2] * (float)Math.random() * (float)(Math.random() < (double)0.5F ? -1 : 1);
  55.          this._gib5.SetVelocity(tempVel);
  56.          tempRotVel[0] = this.rotVelocity[0] * (float)Math.random() * (float)(Math.random() < (double)0.5F ? -1 : 1);
  57.          tempRotVel[1] = this.rotVelocity[1] * (float)Math.random() * (float)(Math.random() < (double)0.5F ? -1 : 1);
  58.          tempRotVel[2] = this.rotVelocity[2] * (float)Math.random() * (float)(Math.random() < (double)0.5F ? -1 : 1);
  59.          this._gib5.SetRotVelocity(tempRotVel);
  60.          this._gib5.SetPhysicsFlags(8);
  61.       }
  62.  
  63.    }
  64.  
  65.    public ClassBreakable(CodexThing gib1, CodexThing gib2, CodexThing gib3, CodexThing gib4, CodexThing gib5, float velX, float velY, float velZ, float rotVelX, float rotVelY, float rotVelZ) {
  66.       this._gib1 = new CodexThing(((Codex)gib1).GetGUID());
  67.       this._gib2 = new CodexThing(((Codex)gib2).GetGUID());
  68.       this._gib3 = new CodexThing(((Codex)gib3).GetGUID());
  69.       this._gib4 = new CodexThing(((Codex)gib4).GetGUID());
  70.       this._gib5 = new CodexThing(((Codex)gib5).GetGUID());
  71.       this.velocity[0] = velX;
  72.       this.velocity[1] = velY;
  73.       this.velocity[2] = velZ;
  74.       this.rotVelocity[0] = rotVelX;
  75.       this.rotVelocity[1] = rotVelY;
  76.       this.rotVelocity[2] = rotVelZ;
  77.    }
  78.  
  79.    public void triggered(int triggeredGUID, int triggererGUID, int triggerID, float p0, float p1, float p2, float p3, int captureID) {
  80.       this._bTriggered = true;
  81.       this._gib1.ClearPhysicsFlags(8);
  82.       this._gib2.ClearPhysicsFlags(8);
  83.       this._gib3.ClearPhysicsFlags(8);
  84.       this._gib4.ClearPhysicsFlags(8);
  85.       this._gib5.ClearPhysicsFlags(8);
  86.    }
  87. }
  88.